package com.test;


import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        int initArr[] = {2,8,3,1,0,4,7,6,5};
        int targetArr[] = {1,2,3,8,0,4,7,6,5};
        NumCode numCode = new NumCode();
        try{
            numCode = new NumCode(initArr,targetArr);
            numCode.show();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }


/*    有解，但堆内存会跑炸
      try{
            initArr = new int[]{1,2,3,4,5,6,7,8,0};
            targetArr = new int[]{2,3,4,8,0,5,1,6,7};
            numCode.setInitArr(initArr);
            numCode.setTargetArr(targetArr);
            numCode.show();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }*/

        initArr = new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0};
        targetArr = new int[]{1,3,7,4,5,2,0,8,9,6,10,11,13,14,15,12};
        numCode.setRowAndCol(4,4);
        try{
            numCode.setInitArr(initArr);
            numCode.setTargetArr(targetArr);
            numCode.show();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }

/*        NumCode numCode = new NumCode();
        List<Integer> list = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8);
        Collections.shuffle(list);
        for (int i = 0; i < list.size(); i++) {
            initArr[i] = list.get(i);
        }
        Collections.shuffle(list);
        for (int i = 0; i < list.size(); i++) {
            targetArr[i] = list.get(i);
        }
        numCode.setInitArr(initArr);
        numCode.setTargetArr(targetArr);
        numCode.show();*/

/*        try{
            int initArr[] = {1,2,3,4,5,6,7,8,0};
            int targetArr[] = {2,3,4,8,0,5,1,6,7};

            NumCode numCode = new NumCode(initArr,targetArr);
            numCode.show();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }*/

/*        try{
            int initArr[] = {1,2,3,4,5,6,7,8,9,10,11,0};
            int targetArr[] = {1,6,2,4,5,0,3,7,9,10,11,8};

            NumCode numCode = new NumCode(3,4,initArr,targetArr);
            numCode.show();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }*/



    }


/*    初始数码：
            2  6  1
            0  4  3
            7  8  5
    目标数码：
            1  5  7
            0  8  6
            3  4  2
     初始数码：
      8  3  6
      5  2  0
      7  1  4
    目标数码：
      7  3  0
      4  5  1
      6  8  2

        初始数码：
      2  4  1
      3  0  8
      6  7  5
    目标数码：
      0  4  2
      7  8  5
      6  1  3

      初始数码：
  7  3  0
  4  5  6
  8  1  2
目标数码：
  1  3  8
  4  6  5
  2  7  0



            */

}
